<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>
  <script>
    // 通过构造函数+原型对象:模拟实现继承,称为组合继承
    /* 
      call()
        调用这个函数,并且修改函数运行时的this指向
        fun.call(thisArg,arg1,arg2);
        thisArg: 当前调用函数this的指向对象
        arg1,arg2: 传递其它的参数
     */
    let fn = function (x, y) {
      console.log(this);
      console.log(x + y);
    };
    let obj = {
      "name": "cz"
    };
    fn.call();
    fn.call(obj, 1, 2); //call()改变了this的指向并传递参数了
  </script>
</body>

</html>